import { createRouter, createWebHashHistory } from 'vue-router'
import LoginView from '@/views/LoginView.vue'
import RegistView from '@/views/RegistView.vue'
import IndexView from '@/views/IndexView.vue'
import TestView from '@/views/sub-function/TestView.vue'
import ArtistManagementView from '@/views/sub-function/ArtistManagementView.vue'
import ArtistPersonalView from '@/views/sub-function/ArtistPersonalView.vue'
import AgentArtistPersonalView from '@/views/sub-function/AgentArtistPersonalView.vue'
import DashboardView from '@/views/sub-function/DashboardView.vue'
import AgentManagementView from '@/views/sub-function/AgentManagement.vue' 
import SystemManagementView from '@/views/sub-function/SystemManagement.vue'
import VenueManagementView from '@/views/sub-function/VenueManagement.vue'
import VenueInformationOverview from '@/views/sub-function/VenueManagement/VenueInformationOverview.vue'
import VenueReservation from '@/views/sub-function/VenueManagement/VenueReservation.vue'
import VenueReservationOverview from '@/views/sub-function/VenueManagement/VenueReservationOverview.vue'
import VenueRepairReport from '@/views/sub-function/VenueManagement/VenueRepairReport.vue'
import VenueRepairReportOverview from '@/views/sub-function/VenueManagement/VenueRepairReportOverview.vue'
import AgentPersonalView from '@/views/sub-function/AgentPersonalView.vue'
import DeepSeekAssistantView from '@/views/sub-function/AI_Assistant/DeepSeekAssistantView.vue'


const routes = [
  {
    path: '/',
    redirect: () => {
      // 检查用户是否已登录
      if (sessionStorage.getItem('username')) {
        return '/index/dashboard';
      } else {
        return '/login';
      }
    }
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView,
    meta: {
      title: '登录',
      showFloatingBall: false // 添加此标记，表示不显示悬浮球
    }
  },
  {
    path: '/regist',
    name: 'regist',
    component: RegistView,
    meta: {
      title: '注册',
      showFloatingBall: false // 添加此标记，表示不显示悬浮球
    }
  },
  {
    path: '/index',
    name: 'index',
    component: IndexView,
    meta: {
      title: '首页'
    },
    redirect: '/index/dashboard',
    children: [
      {
        path: '/index/test',
        name: 'test',
        component: TestView,
        meta: {
          title: '测试页面'
        }
      },
      {
        path: '/index/artistPersonal',
        name: 'artistPersonal',
        component: ArtistPersonalView,
        meta: {
          title: '艺人个人页面'
        }
      },
      {
        path: '/index/artistManagement',
        name: 'artistManagement',
        component: ArtistManagementView,
        meta: {
          title: '艺人管理'
        }
      },
      {
        path: '/index/dashboard',
        name: 'dashboard',
        component: DashboardView,
        meta: {
          title: '仪表盘'
        }
      },
      {
        path: '/index/AgentArtistPersonal',
        name: 'AgentArtistPersonal',
        component: AgentArtistPersonalView,
        meta: {
          title: '艺人管理个人页面'
        }
      },
      {
        path: '/index/AgentManagement',
        name: 'AgentManagement',
        component: AgentManagementView,
        meta: {
          title: '经纪人管理页面'
        }
      },
      {
        path: '/index/AgentPersonal',
        name: 'AgentPersonal',
        component: AgentPersonalView,
        meta: {
          title: '经纪人个人页面'
        }
      },
      {
        path: '/index/SystemManagement',
        name: 'SystemManagement',
        component: SystemManagementView,
        meta: {
          title: '系统管理页面'
        }
      },
      {
        path: '/index/VenueManagement',
        name: 'VenueManagement',
        component: VenueManagementView,
        meta: {
          title: '场馆管理页面'
        }
      },
      {
        path: '/index/VenueManagement/VenueInformationOverview',
        name: 'VenueInformationOverview',
        component: VenueInformationOverview,
        meta: {
          title: '场馆信息总览'
        }
      },
      {
        path: '/index/VenueManagement/VenueReservation',
        name: 'VenueReservation',
        component: VenueReservation,
        meta: {
          title: '场馆预约'
        }
      },
      {
        path: '/index/VenueManagement/VenueReservationOverview',
        name: 'VenueReservationOverview',
        component: VenueReservationOverview,
        meta: {
          title: '场馆预约信息总览'
        }
      },
      {
        path: '/index/VenueManagement/VenueRepairReport',
        name: 'VenueRepairReport',
        component: VenueRepairReport,
        meta: {
          title: '场馆报修'
        }
      },
      {
        path: '/index/VenueManagement/VenueRepairReportOverview',
        name: 'VenueRepairReportOverview',
        component: VenueRepairReportOverview,
        meta: {
          title: '场馆报修信息总览'
        }
      },
      {
        path: '/index/AI_Assistant/DeepSeekAssistantView',
        name: 'DeepSeekAssistantView',
        component: DeepSeekAssistantView,
        meta: {
          title: 'DeepSeek小助手'
        }
      },
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
